package com.cfh.springcloudfeignconsumer.controller;

import com.cfh.domain.User;
import com.cfh.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenfh
 * @date 2019/7/8
 */

@RestController
public class ConsumerController{

    @Autowired
    public HelloService helloService;

    @GetMapping("/feign-consumer")
    public String helloConsumer() {
        return helloService.hello();
    }

    @GetMapping("/feign-consumer2")
    public String helloConsumer2() {
        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello());
        sb.append(helloService.hello("cfh")).append("\n");
        sb.append(helloService.hello("cfh", 20)).append("\n");
        sb.append(helloService.hello(new User("cfh", 20))).append("\n");
        return sb.toString();

    }

}
